#!/usr/bin/python3
# -*- coding: utf-8 -*-
# time    : 2018/7/31 上午11:24
# author  : Jasonsey Max
# email   : linux_2012@outlook.com
# project_name: image_to_txt
# file    : run.py.py
# ==============================================================================
import argparse
from pathlib import Path
import wx
from tools.frame import Myframe
from tools.init_data import InputFile, OutputFile


parser = argparse.ArgumentParser(description='参数')
parser.add_argument('--flag', type=str, default='run', help='启动配置')

Args = parser.parse_args()

if __name__ == '__main__':
    if Args.flag == 'init':
        inp = InputFile(data_path=Path('../data'), db_file=Path('db/db.json'))
        print(inp.dicts)
        print('*' * 20, 'all file have been read to db', '*' * 20)
    elif Args.flag == 'save':
        oup = OutputFile(data_path=Path('../data'), file_name='file_new.txt', db_file=Path('db/db.json'))
        print('*' * 20, 'writen to file', '*' * 20)
    else:
        app = wx.App()
        frame = Myframe(data_base=Path('../data'), db_file=Path('db/db.json'))
        frame.Show()
        app.MainLoop()
